/* 
let a =[1,2,3,5,6,66,0]
let arrmin=[];
let k = 2;
for (let index = 0; index < a.length; index++) {
    const element = a[index];
    if(arrmin.length<k){
        arrmin.push(element)
    }else {
        for (let j = 0; j < arrmin.length; j++) {
            if(arrmin[0]<element&& arrmin[1]>element){
                arrmin[0]=element
            }else{
                arrmin[1]=element
            }
        }
    }
}
console.log(`arrmin`, arrmin)*/
let a =[66,2,3,5,6,1]
let k = 635;
let count=0;
for (let index = 0; index < a.length; index++) {
    let element = a[index];
    let use = k/element;
  
    count+=use;
    console.log(`use`, use)
    k=k-element*use;
    console.log(`需要面额为${element}的${use}张`)
    console.log(`剩余金额`+k)
}